<!-- OtherPages1.vue 一级菜单 -->
<template>
  <div class="OtherPages1">
    <div class="container">
      <!-- 面包屑 -->
      <div class="mianbao">
        <el-breadcrumb separator-class="el-icon-arrow-right">
          <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
          <el-breadcrumb-item>{{ mbName }}</el-breadcrumb-item>
        </el-breadcrumb>
      </div>
      <!-- 轮播图 -->
      <div style="height: 500px; background: #ccc">
        <home-banner></home-banner>
      </div>
      <!-- 全部分类 -->
      <div class="all_classification">
        <h3>全部分类</h3>
        <ul class="fenlei_list">
          <li v-for="item in allFenlei" :key="item.id">
            <div @click="onOtherPage2(item.id)">
              <img :src="item.picture" alt="" />
              <p>{{ item.name }}</p>
            </div>
          </li>
        </ul>
      </div>
      <!-- 查看更多 -->
      <div class="box" v-for="item in yijiList" :key="item.id">
        <div class="box_top">
          <h3>- {{ item.name }} -</h3>
          <p class="tag">温暖柔软，品质之选</p>
          <a href="#" class="rig_look">
            <span>查看全部</span>
            <i class="el-icon-arrow-right"></i>
          </a>
        </div>
        <div class="box_bottom">
          <router-link
            :to="`/particulars/${i.id}`"
            v-for="i in item.goods"
            :key="i.id"
            class="items"
          >
            <el-image :src="i.picture" lazy></el-image>
            <p class="p1 ellipsis">{{ i.name }}</p>
            <p class="p2 ellipsis">{{ i.desc }}</p>
            <p class="p3">￥{{ i.price }}</p>
          </router-link>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import HomeBanner from '@/components/HomeBanner.vue'
export default {
  name: 'OtherPages1',
  props: {
    allFenlei: Array,
    yijiList: Array,
    mbName: String,
  },
  components: {
    HomeBanner,
  },
  methods: {
    onOtherPage2(id) {
      console.log(id)
      this.$router.push({
        path: '/about2',
        query: {
          id,
        },
      })
    },
  },
}
</script>
<style lang="scss" scoped>
.mianbao {
  padding: 25px 10px;
}
.all_classification {
  width: 100%;
  height: 260px;
  background-color: #fff;
  margin-top: 20px;
  h3 {
    height: 100px;
    font-size: 28px;
    color: #666;
    font-weight: 400;
    text-align: center;
    line-height: 100px;
  }
  .fenlei_list {
    display: flex;
    padding: 0 32px;
    flex-wrap: wrap;
    min-height: 160px;
    li {
      width: 168px;
      height: 160px;
      div {
        text-align: center;
        display: block;
        font-size: 16px;
        color: #333;
        img {
          width: 100px;
          height: 100px;
          vertical-align: middle;
        }
      }
    }
  }
}
.box {
  width: 100%;
  background-color: #fff;
  .box_top {
    margin-top: 20px;
    position: relative;
    h3 {
      font-size: 28px;
      color: #666;
      font-weight: 400;
      text-align: center;
      line-height: 100px;
    }
    .tag {
      text-align: center;
      color: #999;
      font-size: 20px;
      position: relative;
      top: -20px;
    }
    .rig_look {
      position: absolute;
      top: 20px;
      right: 20px;
      text-decoration: none;
      color: #333;
      outline: none;
      span {
        font-size: 16px;
        vertical-align: middle;
        margin-right: 4px;
        color: #999;
      }
    }
  }
  .box_bottom {
    display: flex;
    justify-content: flex-start;
    flex-wrap: nowrap;
    padding: 0 65px 30px;
    .items {
      display: block;
      width: 160px;
      padding: 20px 30px;
      text-align: center;
      transition: all 0.5s;
      text-align: center;
      text-decoration: none;
      color: #333;
      outline: none;
      background-color: #fff;
      margin: 0 2px;
      img {
        width: 160px;
        height: 160px;
      }
      .ellipsis {
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
      }
      p {
        padding-top: 10px;
      }
      .p1 {
        font-size: 16px;
      }
      .p2 {
        color: #999;
        height: 29px;
      }
      .p3 {
        color: #cf4444;
        font-size: 20px;
      }
    }
    .items:hover {
      transform: translateY(-3px);
      box-shadow: 0px 0px 5px 0px rgba(0, 0, 0, 0.2);
    }
  }
}
</style>
